﻿using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;

namespace BarManager.Core.Entity
{
    [DataContract]
    public class Proveedor 
    {
        [DataMember]
        public int Id { get; set; }

        [Required]
        [StringLength(50)]
        [DataMember]
        public string Nombre { get; set; }

        [StringLength(250)]
        [DataType(DataType.MultilineText)]
        [Display(Name = "Descripción")]
        [DataMember]
        public string Descripcion { get; set; }

        [Required]
        [DataType(DataType.PhoneNumber)]
        [RegularExpression(@"^\d{6,15}", ErrorMessage = "El telefono debe contener entre 6 y 15 digitos")]
        [Display(Name = "Teléfono 1")]
        [DataMember]
        public long? Telefono1 { get; set; }
                
        [DataType(DataType.PhoneNumber)]
        [RegularExpression(@"^\d{6,15}", ErrorMessage = "El telefono debe contener entre 6 y 15 digitos")]
        [Display(Name = "Teléfono 2")]
        [DataMember]
        public long? Telefono2 { get; set; }

        [DataMember]
        public virtual ICollection<Producto> ProductoList { get; set; }

        public Proveedor()
        {
            this.ProductoList = new List<Producto>();
        }
    }
}
